<template>
	<view class="wrap">
		<view class="set-list">
			<view class="set-list-line">
				<u--text align="left" text="头像"></u--text>
				<view class="right-box u-flex">
					<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
						<image class="head-img" :src="avatar"></image>
					</button>
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
			<view class="set-list-line">
				<u--text align="left" text="昵称"></u--text>
				<view class="right-box u-flex">
					<input placeholder="昵称" type="nickname" v-model="nickname" placeholder-class="placeholderClass" />
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
			<view class="set-list-line" @click="show = true">
				<u--text align="left" text="年龄"></u--text>
				<view class="right-box u-flex">
					<text>{{height}}</text>
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
			<view class="set-list-line">
				<u--text align="left" text="性别"></u--text>
				<view class="right-box u-flex">
					<ul class="tabs-ul">
						<li class="tabs-ul-li" :class="{active:item.id==activeTab}" v-for="(item, index) in tabs"
							:key="index" @click="changeTab(item.id)">{{ item.title }}</li>
					</ul>
				</view>
			</view>
			<view class="set-list-line" @click="show = true">
				<u--text align="left" text="身高"></u--text>
				<view class="right-box u-flex">
					<text>{{height}}</text>
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
			<view class="set-list-line" @click="show = true">
				<u--text align="left" text="常住地"></u--text>
				<view class="right-box u-flex">
					<text>{{height}}</text>
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
			<view class="set-list-line" @click="show = true">
				<u--text align="left" text="户籍地"></u--text>
				<view class="right-box u-flex">
					<text>{{height}}</text>
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
			<view class="set-list-line" @tap="goPage('/pages/uc/editInformation?type=1')">
				<u--text align="left" text="签名"></u--text>
				<u-icon name="arrow-right"></u-icon>
			</view>
			<view class="set-list-line" @tap="goPage('/pages/uc/editInformation?type=2')">
				<u--text align="left" text="个性介绍"></u--text>
				<u-icon name="arrow-right"></u-icon>
			</view>
			<view class="set-list-line" @tap="goPage('/pages/uc/editInformation?type=3')">
				<u--text align="left" text="择偶标准"></u--text>
				<u-icon name="arrow-right"></u-icon>
			</view>
		</view>
		<u-picker :show="show" :columns="columns" @confirm="confirm"></u-picker>
		<view class="button">
			<u-button size="nomal" color="#e16b8c" text="下一步"></u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				avatar: "https://cdn.uviewui.com/uview/album/1.jpg",
				nickname: "",
				activeTab: 1, // 当前活跃的选项卡ID
				tabs: [{
						id: '1',
						title: '男'
					},
					{
						id: '2',
						title: '女'
					},
				],
				show: false,
				columns: [
					['中国', '美国', '日本']
				],
				height:""
			}
		},
		methods: {
			onChooseAvatar(e) {
				this.avatar = e.detail.avatarUrl
				this.uploadFilePromise(e.detail.avatarUrl)
			},
			changeTab(id) {
				this.activeTab = id;
			},
			// 回调参数为包含columnIndex、value、values
			confirm(e) {
				console.log('confirm', e)
				this.show = false
				this.height=e.value[0]
			}
		}
	}
</script>

<style lang="less">
	.wrap {
		display: flex;
		flex-direction: column;
		background: #f4f4f4;
	}

	button::after {
		border: none;
	}

	button {
		margin-left: 0;
		margin-right: 0;
		padding-left: 0;
		padding-right: 0;
		line-height: 1;
		color: #FFFFFF;
		font-size: 28rpx;
		background: none;
		width: 100%;
		border: none;
	}

	.set-list {
		display: flex;
		flex-direction: column;
		padding: 0 30upx;
		background: #fff;

		.set-list-line {
			display: flex;
			flex-direction: row;
			padding: 30upx 0;
			background: #fff;
			border-bottom: 1rpx solid #E1E5ED;

			.right-box {
				font-size: 28upx;
				input {
					font-size: 28upx;
					text-align: right;
				}
			}
		}
	}

	.tabs-ul {
		display: flex;
		flex-direction: row;
		list-style: none;
		height: 65rpx;
		line-height: 65rpx;
		text-align: center;
		margin: 0;
		padding: 0;

		.tabs-ul-li {
			width: 100upx;
			height: 40upx;
			line-height: 40upx;
			text-align: center;
			border-radius: 50upx;
			font-size: 28upx;
		}

		.active {
			background-color: #e16b8c;
			color: #fff;
		}
	}

	.avatar-wrapper {
		border: 1upx solid #eee;
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;
		margin: auto;
	}

	.head-img {
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;
		overflow: hidden;
	}

	.button {
		background: #fff;
		padding: 80upx 60upx 0upx 60upx;
	}
</style>